Infinity Dashboard Custom Module Tutorial
Creating Your First Module: Hello World
NOTE — You can download the final resources from this tutorial by clicking here.
Starting a new module project is as simple as:
Step 1 – Create the module directory
- Open Finder and Create a new Folder named:
Hello World.infinitymodule - Click the Add button when asked if you want to add the
infinitymoduleextension to the folder - The icon for the folder will immediately change to the Infinity Dashboard app icon.
- Double clicking this module will open it in Infinity Dashboard and you will then be prompted to install the module.
- Open the created directory in your preferred code editor.
- Continue to the next step
TIP — To open the contents of this directory in Finder, Right Click the file, then select the Show Package Contents option.
Step 2 – Create the required files
package.json
- In your editor Create a file named
package.json - Enter the following into the newly created
package.jsonfile
{
"name": "Hello World",
"description": "A simple introduction to custom modules.",
"author": "Your Name Here",
"category": "utilities",
"bundleID": "com.uniquebundle.helloworld",
"version": "1.0.0",
}
- Save the file
main.js
- In your editor Create a file named
main.js
Step 3 – Writing Code
- Open the newly created main.js file and enter the following:
const fiplab = require('fiplab');
This is the first line of your file, and will allow you access to the fiplab module.
let returnString = 'Hello World';
The second line of your file defines a simple string that will be returned in Infinity Dashboard.
fiplab.exit(returnString, true);
This is the last line of your module and tells Infinity Dashboard that the module is done executing and tells it 2 key things:
- What to display to the user (
returnString) - Whether the result was a success or failure (
true)
Step 4 – Installing the module
- Save the main.js file
- Open the
Infinity Dashboardapp - Click the
Cogin the top corner of the window - Click the
Preferencesitem - Click the
Custom Modulessection - Click the Install Module button
- Locate the
infinitymodulefile you want to install - Click the Install button
Step 5 – Activating your custom module
In the Infinity Dashboard preferences
- Click the
Module Configsection - Select the group you want to add the module to
- Click the Add Module button
- Scroll down to the bottom of the list until you see the
User Modulessection - Locate your newly installed module in the list
- Click the
checkboxto select it - Click the Add Selected button
Success! — You’ve just made and installed your own custom module in Infinity Dashboard.
I see a red triangle when I run my module
This means your module encountered an error when it was trying to run or the success argument in the fiplab.exit method was set to false. You can debug your module and see the error by doing the following:
- Open Infinity Dashboard.app
- Click the
Cogin the top corner of the window - Click the
Preferencesitem - Click on the ‘Module Config’ item in the sidebar
- Locate the module that has an error
- Click the Pencil icon to open the module configuration
- Locate and click the Logs tab
- The output logs will be displayed here